import React from 'react';
import { Modal } from 'antd';

type TProps = {
  open: boolean;
  modalText: string;
  confirmLoading: boolean;
  onSubmit: TAnyFunction;
  onCancel: TAnyFunction;
};

const DeleteModal: React.FC<TProps> = (props) => {
  const { onSubmit, onCancel, open, modalText, confirmLoading } = props;

  const handleOk = () => {
    onSubmit();
  };

  const handleCancel = () => {
    onCancel();
  };

  return (
    <>
      <Modal
        title="提醒"
        open={open}
        confirmLoading={confirmLoading}
        onOk={handleOk}
        onCancel={handleCancel}
      >
        <p>{`确定要删除"${modalText}"吗?`}</p>
      </Modal>
    </>
  );
};

export default DeleteModal;
